package com.fanpan26.source.concurrent;

import java.util.Enumeration;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author fanpan26
 */
public class ConcurrentHashMapSourceCode {
    public static void main(String[] args) {
        ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(100);

        System.out.println("map.put(\"testKey\",\"testValue\")=" + map.put("testKey", "testValue"));
        System.out.println("  map.putIfAbsent(\"testKey\",\"testValue1\")=" + map.putIfAbsent("testKey", "testValue1"));

        map.get("testKey");
        int size = map.size();
        Enumeration<String> enumeration = map.elements();
        while (enumeration.hasMoreElements()) {
            System.out.println(enumeration.nextElement());
        }
    }
}
